#include "test.pb.h"
#include <iostream>
#include <string>
using namespace zlk;

int main(){
    
}
int main1()
{
    //封装了login请求对象的数据
    LoginRequest req;
    req.set_name("zhang san");
    req.set_pwd("123456");

    //对象数据序列化-》char *
    std::string send_str;
    if (req.SerializeToString(&send_str))//序列化
    {
        std::cout << send_str.c_str() << std::endl;//c_str才输出，直接输出没输出来
    }

    //从send_str反序列化一个login请求对象
    LoginRequest reqB;
    if(reqB.LoginRequest::ParseFromString(send_str))
    {
        std::cout << reqB.name() << std::endl;
        std::cout << reqB.pwd() << std::endl;
    }
    return 0;
}